package com.yenlien.traceyun.business.dao;

import com.yenlien.traceyun.business.entity.Technology;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by LiuSha on 2020/6/11.
 */
public interface TechnologyDao extends BaseJpaDao<Technology> {
    Technology findById(String id);

    @Query(value = "select * from t_technology where p_id =?1 ORDER BY sort ASC", nativeQuery = true)
    List<Technology> findByPId(String pId);

    @Query(value = "select * from t_technology where company_id=?1 AND (p_id is NULL or p_id ='') ", nativeQuery = true)
    List<Technology> findByCompanyId(String companyId);

    @Query(value = "select * from t_technology where p_id is NULL or p_id=''", nativeQuery = true)
    List<Technology> findAll();

    @Query(value = "select * from t_technology where product_name=?1 AND (p_id is NULL or p_id ='')", nativeQuery = true)
    List<Technology> findByProductName(String name);

}
